using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using hao_Dto;
using hao_Model.Enums;

namespace Order.Service
{
    /// <summary>
    /// 订单服务接口
    /// </summary>
    public interface IOrderService
    {
        // 基础CRUD
        Task<Guid> CreateOrderAsync(CreateOrderDto dto, Guid buyerId);
        Task<OrderResponseDto> GetOrderByIdAsync(Guid orderId);
        Task<OrderResponseDto> GetOrderByNumberAsync(string orderNumber);
        Task<bool> UpdateOrderAsync(Guid orderId, CreateOrderDto dto);
        Task<bool> CancelOrderAsync(Guid orderId, string reason, Guid operatorId);
        
        // 订单列表查询
        Task<(List<OrderListDto> orders, int total)> GetOrdersAsync(OrderSearchDto searchDto);
        Task<List<OrderListDto>> GetBuyerOrdersAsync(Guid buyerId, OrderStatus? status = null);
        Task<List<OrderListDto>> GetSellerOrdersAsync(Guid sellerId, OrderStatus? status = null);
        
        // 订单状态管理
        Task<bool> SellerConfirmOrderAsync(Guid orderId, Guid sellerId, string sellerMessage = null);
        Task<bool> ConfirmReceiptAsync(Guid orderId, Guid buyerId);
        Task<bool> CompleteOrderAsync(Guid orderId);
        
        // 物流信息查询（第三方API）
        Task<TrackingInfoDto> GetTrackingInfoAsync(string trackingNumber);
        Task<bool> UpdateDeliveryStatusAsync(Guid orderId, DeliveryStatus status);
        
        // 订单统计
        Task<OrderStatisticsDto> GetOrderStatisticsAsync(Guid? userId = null);
        Task<List<OrderDailyStatsDto>> GetDailyOrderStatsAsync(DateTime startDate, DateTime endDate, Guid? userId = null);
        
        // 业务验证
        Task<bool> ValidateOrderOwnershipAsync(Guid orderId, Guid userId);
        Task<bool> ValidateSellerOwnershipAsync(Guid orderId, Guid sellerId);
        Task<bool> CanCancelOrderAsync(Guid orderId);
        Task<bool> CanConfirmOrderAsync(Guid orderId);
    }
}